package fr.labri.macchiato.framework.business.model.product;

import fr.labri.macchiato.framework.business.model.businessEntity.BusinessEntity;

/**
 * Provides a set of methods to instantiate products
 * @author Matthieu FOUCAULT
 */
public class ProductFactory {


	/**
	 * 
	 * Creates a new instance of an article with the given name
	 * 
	 * @param name
	 *            The article's name
	 * @return The new Article
	 * 
	 * @see Article
	 */
	public static Article newArticle(String name) {
		return new Article(name);
	}

	/**
	 * 
	 * Creates a new instance of a model with the given EAN-13 bar-code and name
	 * 
	 * @param ean13
	 *            The EAN-13 bar-code of the model
	 * @param name
	 *            The model's name
	 * @return The new Model
	 */
	public static Model newModel(String ean13, String name) {
		return new Model(ean13, name);

	}

	/**
	 * Creates a new instance of an offer for the given {@link Model} and {@link BusinessEntity}.
	 * The provider must demand a price for the Offer
	 * @param model 
	 * @param provider 
	 * @param price 
	 * 
	 * @return An instance of the offer
	 */
	public static Offer newOffer(Model model, BusinessEntity provider, double price) {
		return new Offer(model, provider, price);
	}
	
	/**
	 * Creates a new instance of an offer for the given model's name, ean, provider's name and price.
	 * @param modelName 
	 * @param ean13 
	 * @param providerName 
	 * @param price 
	 * 
	 * @return An instance of the offer
	 */
	public static Offer newOffer(String modelName, String ean13, String providerName, double price) {
		Model model = new Model(ean13, modelName);
		BusinessEntity provider = new BusinessEntity(providerName);
		
		return newOffer(model, provider, price);
	}

}
